// use playwright::{
//     api::{Browser, BrowserContext, Page, ProxySettings},
//     Playwright,
// };
// use scraper::{Html, Selector};
// use std::{collections::HashMap, future::Future, path::Path};

// pub async fn goto_page<F, Fut>(
//     executable_path: &str,
//     url: &str,
//     proxy: ProxySettings,
//     args: &Vec<String>,
//     headless: bool,
//     callback: F,
// ) -> Result<HashMap<String, String>, playwright::Error>
// where
//     F: FnOnce(&Page, &Browser, &BrowserContext) -> Fut,
//     Fut: Future<Output = Result<HashMap<String, String>, playwright::Error>> + 'static,
// {
//     let playwright = Playwright::initialize().await?;
//     let chromium = playwright.chromium();
//     let browser = chromium
//         .launcher()
//         .headless(headless)
//         .executable(Path::new(executable_path))
//         .proxy(proxy)
//         .args(args)
//         .launch()
//         .await?;
//     let context = browser.context_builder().build().await?;
//     let page = context.new_page().await?;
//     page.goto_builder(url).timeout(100000.0).goto().await?;
//     let result = callback(&page, &browser, &context).await?;
//     context.close().await?;
//     browser.close().await?;
//     Ok(result)
// }

// pub fn get_text_form_html(html: &str, selector: &str) -> String {
//     let document = Html::parse_document(html);
//     let selector = match Selector::parse(selector) {
//         Ok(selector) => selector,
//         Err(_) => return "".to_string(),
//     };
//     match document.select(&selector).next() {
//         Some(element) => element.text().collect::<String>(),
//         None => "".to_string(),
//     }
// }

// pub fn get_attr_form_html(html: &str, selector: &str, attr: &str) -> String {
//     let document = Html::parse_document(html);
//     let selector = match Selector::parse(selector) {
//         Ok(selector) => selector,
//         Err(_) => return "".to_string(),
//     };
//     match document.select(&selector).next() {
//         Some(element) => element.value().attr(attr).unwrap_or("").to_string(),
//         None => "".to_string(),
//     }
// }

// pub fn get_texts_form_html(html: &str, selector: &str) -> Vec<String> {
//     let document = Html::parse_document(html);
//     let selector = match Selector::parse(selector) {
//         Ok(selector) => selector,
//         Err(_) => return vec![],
//     };
//     let mut texts = vec![];
//     for element in document.select(&selector) {
//         texts.push(element.text().collect::<String>());
//     }
//     texts
// }

// pub fn get_attrs_form_html(html: &str, selector: &str, attr: &str) -> Vec<String> {
//     let document = Html::parse_document(html);
//     let selector = match Selector::parse(selector) {
//         Ok(selector) => selector,
//         Err(_) => return vec![],
//     };
//     let mut attrs = vec![];
//     for element in document.select(&selector) {
//         attrs.push(element.value().attr(attr).unwrap_or("").to_string());
//     }
//     attrs
// }
